- import_playbook: "/srv/web/infra/ansible/playbooks/include/virt-create.yml myhosts=debuginfod:debuginfod_stg"

- name: make the box be real
  hosts: debuginfod:debuginfod_stg
  user: root
  gather_facts: True

  vars_files:
   - /srv/web/infra/ansible/vars/global.yml
   - "/srv/private/ansible/vars.yml"
   - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  pre_tasks:
  - import_tasks: "{{ tasks_path }}/yumrepos.yml"

  roles:
  - base
  - rkhunter
  - nagios_client
  - hosts
  - ipa/client
  - collectd/base
  
  - role: nfs/client
    mount_stg: true
    mnt_dir: '/mnt/fedora_koji_prod'
    nfs_src_dir: "fedora_koji"

  tasks:
  - import_tasks: "{{ tasks_path }}/motd.yml"
    
  - name: install debuginfod
    package: name=elfutils-debuginfod state=present

  - name: install sqlite for diagnostics
    package: name=sqlite state=present

  - name: install rsync for data backups
    package: name=rsync state=present
    
  - name: install debuginfod configuration
    copy: src="{{ files }}/debuginfod/sysconfig.debuginfod" dest=/etc/sysconfig/debuginfod owner=root group=root mode=644

  - name: ensure systemd drop-in directory exists
    file: >
      dest=/etc/systemd/system/debuginfod.service.d
      state=directory
    
  - name: install debuginfod systemd drop-in
    copy: src="{{ files }}/debuginfod/debuginfod.service.d" dest=/etc/systemd/system/debuginfod.service.d/override.conf owner=root group=root mode=644    

  - name: ensure debuginfod is enabled and started
    service:
      name: debuginfod
      state: started
      enabled: yes
    
  handlers:
  - import_tasks: "{{ handlers_path }}/restart_services.yml"
